<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="minimum-scale=1.0, width=device-width, maximum-scale=1.0, user-scalable=no"/>
    <meta charset="utf-8">
    <title>Immutability</title>
    <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
<h1>Immutability</h1>
<p>Open the console</p>
<script type="text/babel">

    let color_lawn = {
        title: "lawn",
        color: "#00FF00",
        rating: 0
    }

    const rateColor = (color, rating) =>
        ({
            ...color,
            rating
        })

    //
    // Or the ...spread operator, even better
    //

    console.log(rateColor(color_lawn, 5).rating)
    console.log(color_lawn.rating)

</script>
</body>
</html>
